<%@ page language="java" contentType="text/html; charset=ISO-8859-1"  pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
	function clienteListar(){
		location.href = "ClienteListar?nomePes="+document.getElementById("nomePes").value ;
	}
	function alterar(id){
		location.href = "ClienteAlterar?id="+id;	
	}
	function excluir(id){
		location.href = "ClienteExcluir?id="+id;
	}
</script>
<title>Listar Cliente</title>
</head>
    <body>
			<div><h1>Cliente</h1></div>
				<div class="filtro" style="width:345px;">
					<Label>Nome: </Label>
					<input type="text" name="nomePes" id="nomePes" />
					<input type="button" value="Pesquisar" class="btnForm" onclick="clienteListar()"/>
				</div>
				 
				<c:if test="${lista != null && lista.size() > 0}">
					<ul >
						<li style="width:215px">Cliente</li>
						<li style="width:125px">Email</li>
					</ul>					
						<ul class="camposLinha">
							<c:forEach items="${lista}" var="list" >
								<li >
									<Label style="width:205px">${list.nome}</Label>
									<a href="#" id="${list.id}" onclick="alterar(this.id)"><Label>Alterar</Label></a>
									<a href="#" id="${list.id}" onclick="excluir(this.id)"><Label>Excluir</Label></a>
								</li>
							</c:forEach>
						</ul>
				</c:if>
				<c:if test="${lista == null}">
							<Label style="width:385px">Nenhum Cliente cadastrado!</Label>
					</ul>
				</c:if>
				<div class="filtro" style="width:345px;">
					<Label>Resultado:</Label>
				</div>
</body>
</html>